var add_form_panels = Ext.create("Ext.form.Panel", {
	url: "",
	buttonAlign: "center",
	bodyStyle: "padding: 10px;",
	defaultType: "textfield",
	id: "formMain",
	width: 450,
	items: [{
			fieldLabel: "委托业务",
			emptyText: "请选择委托业务",
			name: "",
			width: "100%"
		},
		{
			xtype: "combo",
			fieldLabel: "委托人",
			emptyText: "请选择委托人姓名",
			name: "",
			//allowBlank: false,//是否允许为空
			editable: false,//是否可编辑
			lazyInit: false,//延时初始化下拉列表，默认为true
			triggerAction: 'all',
			valueField: 'value',
			width: "100%",
			store: new Ext.data.ArrayStore({
				fields: ['value', 'text'],
				data: [
						["1", "张三"],
						["0", "李四"]
				],
			}),
		},
		{
			xtype: "combo",
			fieldLabel: "被委托人",
			emptyText: "请选择被委托人姓名",
			name: "",
			//allowBlank: false,//是否允许为空
			editable: false,//是否可编辑
			lazyInit: false,//延时初始化下拉列表，默认为true
			triggerAction: 'all',
			valueField: 'value',
			width: "100%",
			store: new Ext.data.ArrayStore({
				fields: ['value', 'text'],
				data: [
						["1", "张三"],
						["0", "李四"]
				],
			}),
		},
		{
			xtype: "datefield",
			format: "Y-m-d",
			editable: false,
			fieldLabel: "委托开始时间",
			emptyText: "请选择委托开始时间",
			name: "",
			width: "100%"
		},
		{
			xtype: "datefield",
			format: "Y-m-d",
			editable: false,
			fieldLabel: "被委结束时间",
			emptyText: "请选择委托结束时间",
			name: "",
			width: "100%"
		},
		{  xtype : 'radiogroup',
		    fieldLabel : '是否启用',
		    name:'',
		    items : [
		    			{
		    				boxLabel : '置顶',
		    				name:'isTop',
		    				inputValue : '1'
		                }, 
		                {	
		                	boxLabel : '不置顶',
		                	name:'isTop',
		                	inputValue : '0',
		                	checked:true
		                }
		             ]
		},
		{
			xtype: 'textarea',
			labelWidth: 100,
			emptyText: "请填写委托原因",
			fieldLabel: '委托原因',
			width: 400
		}
	],
	buttons: [{
		text: "保存",
		formBind: true, // only enabled once the form is valid
		disabled: true,
		handler: function() {
			var form = this.up("form").getForm();
			if (form.isValid()) {
				form.submit({
					waitMsg: "保存中...",
					success: function(form, action) {
						Ext.Msg.alert("提示", action.result.result);
						add_form_panel_wins.close();
						dataStore2.load();
					},
					failure: function(form, action) {
						Ext.Msg.alert("提示", "操作失败！");
					}
				});
			}
		}
	}]
});

var add_form_panel_wins = Ext.create("Ext.Window", {
	title: "新增委托信息",
	closeAction: "hide",
	items: add_form_panels,
});

function myAdd() {
	add_form_panels.getForm().reset();
	add_form_panel_wins.show();
	add_form_panels.getForm().isValid();
}
